﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using YJKRGeometry;

namespace YJKArchMethodLibrary.ColumnProfileAnalyze
{
	public class ColumnProfileInfo
	{
		public XYZ Location
		{
			get
			{
				return this.m_Location;
			}
		}

		public List<XYZ> Loop
		{
			get
			{
				return this.m_Loop;
			}
		}

		public ColumnProfileInfo(ColumnProfileInfo profile)
		{
			this.m_Location = profile.Location;
			this.m_Loop = profile.Loop;
			this.m_MaxSpaceLocation2Vertices = profile.m_MaxSpaceLocation2Vertices;
		}

		public ColumnProfileInfo(XYZ location, List<XYZ> loop)
		{
			this.m_Location = location;
			this.m_Loop = loop;
			foreach (XYZ xyz in this.m_Loop)
			{
				double num = xyz.DistanceTo(this.Location);
				if (Geometry.GreaterThan(num, this.m_MaxSpaceLocation2Vertices))
				{
					this.m_MaxSpaceLocation2Vertices = num;
				}
			}
		}

		public bool IsInside(XYZ pt, bool includeEdge = true)
		{
			return !Geometry.GreaterThan(pt.DistanceTo(this.Location), this.m_MaxSpaceLocation2Vertices) && Geometry.PointInPloygon(this.Loop, pt) != -1;
		}

		private XYZ m_Location;

		private List<XYZ> m_Loop = new List<XYZ>();

		private double m_MaxSpaceLocation2Vertices;
	}
}
